<script type="text/javascript" src="{:U(MODULE_NAME. '/Public/editor')}"></script>
<!-- <script language="javascript" type="text/javascript" src="__PUBLIC__/plugin/autocomplete/jquery.autocomplete.js"></script> -->
<script type="text/javascript" src="/Public/js/jquery.form.min.js"></script>
<!-- <link rel="stylesheet" href="__PUBLIC__/plugin/autocomplete/jquery.autocomplete.css"> -->
<style type="text/css">
  .mt15{ margin-top: 15px;}
  .mt10{ margin-top: 10px;}
  .picture_item {margin:5px;  padding: 5px 5px 40px ; cursor:pointer; width:120px; overflow:hidden;}
  .picture_item2 {border: 1px solid #ff0000;}
  .picture_item .title {padding-left:6px; width: 100%;}
  .page {border-bottom: 0px;}
  .pro-span{display:inline-block; background:#3b8ed3; margin:0 2px;padding:5px 8px; color:#fff; font-size: 12px;vertical-align: middle;line-height: 1;}
  .txtspan{display:inline-block; margin:0 2px;padding:5px; color:#3b8ed3; font-size: 12px;vertical-align: middle;line-height: 1;}
  .ssjgbox{width:550px; min-height:100px;padding: 5px;margin-top:10px; border:1px #c5d6e0 solid; background:#f5f5f5; }
  .ly-addbox{margin: 0 auto;padding: 10px;font-size: 14px;}
  .ly-addbox .label-180{ display: block; float: left; width: 180px; text-align: right;}
  .pircebox{position:absolute;  top:100px; right:35px; background:#f4f4f4; border:1px #dcdcdc solid; width:260px; min-height:200px; padding:8px 15px;box-sizing:border-box;}
  .pricelist dl{ width: 100%; padding: 0;margin:15px 0; list-style: none; }
  .pricelist dl dt{ float: left; display:block; width: 80px; text-align: left; color: #939393}
  .pricelist dl dd{float: left; display:block; text-align: left; color: #939393;}
  .piclist{ margin-top: 25px;}
  .piclist li{float:left; width:325px; margin-right:30px;margin-bottom: 20px; padding:8px;border:1px #c5d6e0 solid; box-sizing:border-box; }
  .l{ float: left;display:block;}
  .r-txt{line-height:1.8; padding-left:10px;}
  .font24{ font-size: 24px;}
  .filebox{width: 150px; height: 120px;  border: 1px #CCC solid;   position: relative; overflow: hidden; text-align: center;vertical-align: middle;cursor: pointer;}
  .filebox .file-btn{width:150px; height: 120px; position: absolute; right: 0;left: 0;bottom: 0;top: 0;margin: auto;opacity: 0;z-index: 9999;}
  .filebox .file-imgbox{position: absolute;width: 150px;height: auto;right: 0;left: 0;bottom: 0;top: 0;margin: auto;}
  .probox{width:780px; margin-bottom:25px; border:1px #c5d6e0 solid; padding:10px;}
</style>
<div class="main_top">
  <a href ="{:U(MODULE_NAME.'/Product/selledit', array('id'=>$id))}" class=" <if condition='$step eq 0'>bg_blue<else/></if>">主要信息</a>
  <a href ="{:U(MODULE_NAME.'/Product/selledit', array('id'=>$id,'step'=>1))}" class=" <if condition='$step eq 1'>bg_blue</if>">产品亮点</a>
  <a href ="{:U(MODULE_NAME.'/Product/selledit', array('id'=>$id,'step'=>2))}" class=" <if condition='$step eq 2'>bg_blue</if>">费用包括</a>
  <a href ="{:U(MODULE_NAME.'/Product/selledit', array('id'=>$id,'step'=>3))}" class=" <if condition='$step eq 3'>bg_blue</if>">预定须知</a>
  <a href ="{:U(MODULE_NAME.'/Product/selledit', array('id'=>$id,'step'=>4))}" class=" <if condition='$step eq 4'>bg_blue</if>">温馨提示</a>
  <a href ="{:U(MODULE_NAME.'/Product/selledit', array('id'=>$id,'step'=>5))}" class=" <if condition='$step eq 5'>bg_blue</if>">赠送信息</a>
  <a href ="{:U(MODULE_NAME.'/Product/selledit', array('id'=>$id,'step'=>6))}" class=" <if condition='$step eq 6'>bg_blue</if>">附加保险</a>
  <a href ="{:U(MODULE_NAME.'/Product/selledit', array('id'=>$id,'step'=>7))}" class=" <if condition='$step eq 7'>bg_blue</if>">优惠券</a>
  <a href ="{:U(MODULE_NAME.'/Product/selledit', array('id'=>$id,'step'=>8))}" class=" <if condition='$step eq 8'>bg_blue</if>">附加产品</a>
  <a href ="{:U(MODULE_NAME.'/Product/selledit', array('id'=>$id,'step'=>9))}" class=" <if condition='$step eq 9'>bg_blue</if>">棉签妹推荐</a>
  <a href ="{:U(MODULE_NAME.'/Product/selledit', array('id'=>$id,'step'=>10))}" class=" <if condition='$step eq 10'>bg_blue</if>">包含单品</a>
  <a href ="{:U(MODULE_NAME.'/Product/selledit', array('id'=>$id,'step'=>11))}" class=" <if condition='$step eq 11'>bg_blue</if>">赠送单品</a>
  <a href ="{:U(MODULE_NAME.'/Trip/indexsell', array('id'=>$id))}" class="<if condition='$a eq "/Trip/index"'>bg_blue</if>">行程参考</a>
  <a href ="{:U(MODULE_NAME.'/Departure/indexsell',array('pid'=>$id))}" >出发日期</a>
  <a href ="{:U(MODULE_NAME.'/AirplaneManage/indexsell',array('pid'=>$id))}" >航班信息</a>
  <a href ="{:U(MODULE_NAME.'/HotelManage/indexsell',array('pid'=>$id))}" >酒店信息</a>

</div>

  <div class="form" style="position: relative;">
  <!--product pricebox-->
<!--   <if condition="$productTypeName">
<div class="pircebox">
  <p style="font-size:20px;">当前{$productTypeName}总成本</p>
  <div class="pricelist">
    <dl>
      <dt>香港出发</dt>
      <dd><font class="red" style="font-size:24px;">800</font>元</dd>
    </dl>
  </div>
  <if condition="$productTypeName neq '产品'">
  <div>
    <p><a href="javascript:productTypeEdit('{$productTypeName}')">新增{$productTypeName}</a></p>
  </div>
  </if>
</div>
</if> -->
    <form method='post' id="form_do" name="form_do" action="{:U('/Home/Product/selledit',array('id'=>$id,'step'=>$step))}">

            <if condition="$step eq false">
            
            <?php if($product['libraryID'] != false) { ?>

            <dl>
              <dt>产品库产品：</dt>
                <dd>
                  <div class="operateDeparture">
                    <input type="text" class="inp_small" name="libraryProductID" onkeyup="getLibrary(this)"  value="{$product.libraryProductID}" disabled="disabled">&nbsp;&nbsp;
                    <input type="text" class="inp_default" name="libraryTitle" value="{$product.libraryTitle}" disabled="disabled" >&nbsp;&nbsp;
                    <input type="hidden" name="libraryID" value="{$product.libraryID}" disabled="disabled" >
                    <span id="departureCitySow" >{$product.departureCityName}</span>&nbsp;&nbsp;
                    <select name="gainType" onchange="changePriceType()" >
                      <option value="0" <if condition="$product['gainType'] eq '0'">selected</if> >成本价</option>
                      <option value="1" <if condition="$product['gainType'] eq '1'">selected</if> >手动输入加价额度</option>
                      <option value="2" <if condition="$product['gainType'] eq '2'">selected</if> >按成本百分比加价%</option>
                    </select>
                    &nbsp;&nbsp;
                    <input type="text" name="gainNums" onkeyup="changePriceType()" style="width:50px;" <if condition="$product['gainType'] eq '0'">disabled</if>  value="{$product.gainNums}"> &nbsp;&nbsp;
                    <!-- <font class="font-green"><span id="priceShow">{$product.sellPrice}</span>元</font> &nbsp;&nbsp; -->
                  </div>
                </dd>
            </dl>
            <?php } ?>


            <dl>
              <dt> 所属兴趣：</dt>
              <dd>
                  <foreach name="catArr" item="catArr">
                  <input type="checkbox" name="catID[]" value="{$catArr.id}" {$catArr.checked} style="margin-left:10px;" />{$catArr.name}
                  </foreach>
              </dd>
            </dl>
            <dl>
              <dt>线路名称：</dt>
              <dd>
                <input type="text" name="title" class="inp_one inp_w550" maxlength="30" value="{$product.title}" /><font color="red">(最长30个字符)</font>
                &nbsp;<input type="checkbox" name="verify" value="0" <if condition="$product['verify'] eq '0'">checked</if> />&nbsp;二次确认
                &nbsp;<input type="checkbox" name="special" value="1" <if condition="$product['special'] eq '1'">checked</if> />&nbsp;特殊产品
              </dd>
            </dl>
            <dl>
              <dt>扩展名称：</dt>
              <dd>
                <input type="text" name="extend" class="inp_one inp_w550" maxlength="35" value="{$product.extend}" /> <font color="red">(最长35个字符)</font>
              </dd>
            </dl>
            <dl>
              <dt>主站分类：</dt>
              <dd>
                 {$categoryHtmlOne}
                 {$categoryHtmlTwo}
              </dd>
            </dl>
            <dl>
              <dt>主站分类标签：</dt>
              <dd id="categoryLabelList">
                  {$categorylabelHtml}
              </dd>
            </dl>
            <dl>
              <dt>出发地：</dt>
                <dd>
                  <foreach name="departureHtmlArr" key="key" item="value">
                  <div class="selectDepartureNums" style="margin-top: 10px;" >
                    <div class="selectDeparture" style="float: left;">
                      {$value}
                    </div>
                    <div class="operateDeparture" style="float: left;">
                      <if condition="$key eq '0'">
                      <a href="javascript:;" onclick="departureCityAdd(this)">添加</a>
                      <else />
                      <a href="javascript:;" onclick="departureCityDel(this)">删除</a>
                      </if>
                    </div>
                    <div class="clear"></div>
                  </div>
                  </foreach>
                </dd>
           </dl>
            <dl>
              <dt> 目的地：</dt>
              <dd>
                <foreach name="destinationArrHtml" key="key" item="value">
                <div class="selectDestinationNums" style="margin-top: 10px;">
                    <div class="selectDestination" style="float: left;">
                      {$value.areaSelect}
                      {$value.countrySelect}
                      {$value.citySelect}
                    </div>
                    <div class="operateDestination" style="float: left;">
                      <if condition="$key eq '0'">
                      <a href="javascript:;" onclick="destinationHtmlAdd(this)">添加</a>
                      <else />
                      <a href="javascript:;" onclick="destinationHtmlDel(this)">删除</a>
                      </if>
                    </div>
                    <div class="clear"></div>
                </div>
                </foreach>
              </dd>
            </dl>
            <dl>
              <dt> 出发时间：</dt>
              <dd>
                <input type="text" class="inp_default" name="departureDate"value="{$product.departureDate}">
              </dd>
            </dl>
            <dl>
              <dt> 行程天数 ：</dt>
              <dd>
                <input type="text" name="travelDays" class="inp_small" value="{$product.travelDays}" />日
                <input type="text" name="travelNight" class="inp_small"  value="{$product.travelNight}"/>晚
                </dd>
            </dl>
             <dl>
              <dt> 市场价：</dt>
              <dd>
                <input type="text" name="marketPrice" class="inp_small" value="{$product.marketPrice}"/> /人起
              </dd>
            </dl>
            <dl>
              <dt> 现价：</dt>
              <dd>
                <input type="text" name="price" class="inp_small" value="{$product.price}"/> /人起
              </dd>
            </dl>
             <dl>
              <dt> 产品缩略图：</dt>
              <dd>
                <div><font color="red">(尺寸:320px*210px)</font></div>
                <div style="width: 160px; height: 105px;  border: 1px #CCC solid;   position: relative;   overflow: hidden; text-align: center;vertical-align: middle;cursor: pointer;">
                  <div  class="fileupload" onclick="uploadImgHtml(this,'Product','litPic')" style="  position: absolute;width: 160px;height: auto;right: 0;left: 0;bottom: 0;top: 0;margin: auto;">
                    <if condition="$product['litPic']">
                      <img src="{$product.litPic}" width="100%" height="100%" />
                      <input type="hidden" name="litPic" class="litPic" value="{$product.litPic}">
                    </if>
                  </div>
                </div>
              </dd>
            </dl>

            <dl>
              <dt> 产品大图：</dt>
              <dd>
              <div><font color="red">(尺寸:宽度1920px为佳，比例2:1)</font></div>
                <div style="width: 240px; height: 120px;  border: 1px #CCC solid;   position: relative;   overflow: hidden; text-align: center;vertical-align: middle;cursor: pointer;">
                  <div  class="fileupload" onclick="uploadImgHtml(this,'Product','bigPic')" style="  position: absolute;width: 240px;height: auto;right: 0;left: 0;bottom: 0;top: 0;margin: auto;">
                    <if condition="$product['bigPic']">
                      <img src="{$product.bigPic}" width="100%" height="100%" />
                      <input type="hidden" name="bigPic" class="bigPic" value="{$product.bigPic}">
                    </if>
                  </div>
                </div>
              </dd>
            </dl>
            <dl>
              <dt> 标识：</dt>
              <dd>
                <input type="radio" name="sign" value="0" <if condition="$product['sign'] eq 0" >checked</if>/>无
                <input type="radio" name="sign" value="1" <if condition="$product['sign'] eq 1" >checked</if> />新品
                <input type="radio" name="sign" value="2" <if condition="$product['sign'] eq 2" >checked</if> />爆款
                <input type="radio" name="sign" value="3" <if condition="$product['sign'] eq 3" >checked</if> />特价
              </dd>
            </dl>
            <dl>
              <dt> 销量：</dt>
              <dd>
                <input type="text" name="saleNums" class="inp_small" value="{$product.saleNums}" />
              </dd>
            </dl>
            <dl>
              <dt> 关键词：</dt>
              <dd>
                <input type="text" name="keyWords" class="inp_w250" value="{$product.keyWords}" />
                <span class="tip">多关键词之间以英文逗号"|"分隔</span></dd>
            </dl>

            <elseif condition="$step eq 1" />
              <if condition="$highlight" >
              <foreach name="highlight" key="key" item="highlight">
                <dl>
                  <dt> 亮点{$key+1}： </dt>
                  <dd>
                    <input type="text"  name="content[]" class="inp_large" maxlength="8" value="{$highlight.content}" />
                    <input type="text"  name="reson[]" class="inp_large" value="{$highlight.reson}" />
                    <input type="hidden" name="highlightID[]" class="inp_large" value="{$highlight.id}" />
                  </dd>
                </dl>
              </foreach>
              <else />
                <dl>
                  <dt> 亮点1： </dt>
                  <dd>
                    <input type="text"  name="content[]" class="inp_large" maxlength="8" value="" />
                    <input type="text"  name="reson[]" class="inp_large" value="" />
                    <input type="hidden" name="sort[]" value="1" />
                  </dd>
                </dl>
                <dl>
                  <dt> 亮点2： </dt>
                  <dd>
                    <input type="text"  name="content[]" class="inp_large" maxlength="8" value="" />
                    <input type="text"  name="reson[]" class="inp_large" value="" />
                    <input type="hidden" name="sort[]" value="2" />
                  </dd>
                </dl>
                <dl>
                  <dt> 亮点3： </dt>
                  <dd>
                    <input type="text"  name="content[]" class="inp_large" maxlength="8" value="" />
                    <input type="text"  name="reson[]" class="inp_large" value="" />
                    <input type="hidden" name="sort[]" value="3" />
                  </dd>
                </dl>
                <dl>
                  <dt> 亮点4： </dt>
                  <dd>
                    <input type="text"  name="content[]" class="inp_large" maxlength="8" value="" />
                    <input type="text"  name="reson[]" class="inp_large" value="" />
                    <input type="hidden" name="sort[]" value="4" />
                  </dd>
                </dl>
              </if>

            <elseif condition="$step eq 2" />

              <dl>
                <dt> 费用包含 ：</dt>
                <dd>
                  <textarea name="costInclude" id="content">{$costInclude}</textarea>
                </dd>
              </dl>

            <elseif condition="$step eq 3" />

              <dl>
                <dt> 预定须知： </dt>
                <dd>
                  <textarea name="reservationNotice" id="content">{$reservationNotice}</textarea>
                </dd>
              </dl>

            <elseif condition="$step eq 4" />

              <dl>
                <dt> 温馨提示内容： </dt>
                <dd>
                  <textarea name="warmReminder" id="content">{$warmReminder}</textarea>
                </dd>
              </dl>

            <elseif condition="$step eq 5" />

              <style>
                .picture_item {margin:5px;  padding: 5px 5px 40px ; cursor:pointer; height: 150px;}
                .picture_item2 {border: 1px solid #ff0000;}
                .picture_item .title {padding-left:6px;overflow:hidden; width:120px;}
                .page { border-bottom: 0 solid #ccc;}
              </style>
               <dl>
                  <dt> 选择赠品：</dt>
                  <dd>
                     <div id="picture_show" style="width:1000px">
                        <foreach name='gifts' item='gifts'>
                        <div class="picture_item <if condition="$gifts['checked'] eq 'checked'">picture_item2</if>">
                            <label for="gift{$gifts.id}">
                            <div class="title">{$gifts.title}</div>
                            <img width="120" height="120" src="{$website_url}{$gifts.litpic}">
                            </label>
                            <input type="checkbox" id="gift{$gifts.id}" name="giftID[]" value="{$gifts.id}" style="margin-left: 48px;" {$gifts.checked}>
                          </div>
                        </foreach>
                      </div>
                  </dd>
               </dl>

            <elseif condition="$step eq 6" />

             <dl>
                <dt> 选择保险：</dt>
                <dd>
                  <style>
                .picture_item {margin:5px;  padding: 5px 5px 40px ; width: 120px; height:160px; cursor:pointer;}
                .picture_item2 {border: 1px solid #ff0000;}
                .picture_item .title {padding-left:6px;overflow:hidden; width:120px; height:18px}
                .picture_item .description { height: 39px;  line-height: 18px; overflow: hidden; padding-left: 6px; width: 120px;}
                .page {border-bottom: 0px;}
                 </style>
                  <div id="picture_show" style="width:1000px">
                    <foreach name='insurance' item='insurance'>
                      <div class="picture_item <if condition="$insurance['checked'] eq 'checked'">picture_item2</if>" >
                        <label for="insurance{$insurance.id}">
                        <div class="title">{$insurance.title}</div>
                        <img width="120" height="120" src="<if condition='$insurance.litpic eq null'>__PUBLIC__/image/baoxian.jpg<else/>http://www.tripvip.cn{$insurance.litpic}</if>">
                        <div class="description">{$insurance.description}</div>
                        </label>
                        <input type="checkbox" id="insurance{$insurance.id}" name="insuranceID[]" value="{$insurance.id}" style="margin-left: 48px;" {$insurance.checked} />
                      </div>
                    </foreach>
                  </div>
                </dd>
              </dl>

            <elseif condition="$step eq 7" />

               <dl>
                <dt> 优惠券选择：</dt>
                <dd>
                  <style>
                .picture_item {margin:5px;  padding: 5px 5px 40px ; width: 120px; height:180px; cursor:pointer;}
                .picture_item2 {border: 1px solid #ff0000;}
                .picture_item .title {padding-left:6px;overflow:hidden; width:120px;}
                .picture_item .description { height: 18px;  line-height: 18px; overflow: hidden; padding-left: 6px; width: 120px;}
                .picture_item .count { height: 34px;  line-height: 18px; overflow: hidden; padding-left: 6px; width: 120px;}
                .page {border-bottom: 0px;}
                 </style>
                  <div id="picture_show" style="width:1000px">
                    <foreach name='coupontypelist' item='v'>
                      <div class="picture_item {$v.picture_item2}" >
                        <label for="coupon{$v.id}">
                        <div class="title">{$v.name}</div>
                        <img width="120" height="120" src="<if condition='$v.litpic eq null'>__PUBLIC__/image/baoxian.jpg<else/>http://www.tripvip.cn{$v.litpic}</if>">
                        <div class="description">¥{$v.amount}</div>
                        </label>
                        <input type="checkbox" id="coupon{$v.id}" name="coupon[]" value="{$v.id}" style="margin-left: 48px;" {$v.checked} />
                      </div>
                    </foreach>
                  </div>
                </dd>
              </dl>

            <elseif condition="$step eq 8" />

            <if condition="$addproduct" >

            <foreach name="addproduct" key="key" item="addproduct">
              <dl>
              <dt> <if condition="$key eq '0'" >当前附加产品：</if></dt>
                <dd>

                    <div style="width: 120px; height: 120px;  border: 1px #CCC solid;   position: relative;   overflow: hidden; text-align: center;vertical-align: middle;cursor: pointer;">
                      <div  class="fileupload"  onclick="uploadImgHtml(this,'addProductImg','img')" style="  position: absolute;width: 120px;height: auto;right: 0;left: 0;bottom: 0;top: 0;margin: auto;">
                        <img src="{$addproduct.img}"  width="120" height="120">
                        <input type="hidden" name="img"  class="headerImg" value="{$addproduct.img}">
                      </div>
                    </div>
                    <div>

                    </div>
                    <div style="margin-left: 150px; margin-bottom: 10px; margin-top: -120px;">
                      <input type="text" name="name" class="name" value="{$addproduct.name}" style="width: 250px;" placeholder="30个字内"  maxlength="30">
                       <span>价格：</span> <input type="text" name="price" class="price" value="{$addproduct.price}" style="  width: 60px;" ><span>元</span>
                    </div>
                    <div style="margin-left: 150px; margin-bottom: 10px; font-size: 12px;">
                      <input type="checkbox"  <if condition="$addproduct.sumType neq '0'" >checked</if> ><span>默认购买</span>&nbsp;&nbsp;
                      <span>默认购买数量</span>
                      <input type="radio" name="sumType_{$key+1}" class="sumType_{$key+1}" value="O" <if condition="$addproduct.sumType eq 'O'" >checked</if>><span>一个</span>
                      <input type="radio" name="sumType_{$key+1}" class="sumType_{$key+1}" value="V" <if condition="$addproduct.sumType eq 'V'" >checked</if>><span>游客总数</span>
                      <input type="radio" name="sumType_{$key+1}" class="sumType_{$key+1}" value="T" <if condition="$addproduct.sumType eq 'T'" >checked</if>><span>成人总数</span>
                      <input type="radio" name="sumType_{$key+1}" class="sumType_{$key+1}" value="C" <if condition="($addproduct.sumType neq 'O') AND ($addproduct.sumType neq 'V') AND ($addproduct.sumType neq 'T') AND ($addproduct.sumType neq '0')" >checked</if> >
                      <span>自定义</span><input type="text" name="custom" class="custom" value="<if condition="($addproduct.sumType neq 'O') AND ($addproduct.sumType neq 'V') AND ($addproduct.sumType neq 'T') AND ($addproduct.sumType neq '0')" >{$addproduct.sumType} </if>" style=" width: 50px;" <if condition="($addproduct.sumType neq 'O') AND ($addproduct.sumType neq 'V') AND ($addproduct.sumType neq 'T') AND ($addproduct.sumType neq '0')" ><else />disabled</if>>
                    </div>
                    <div style="margin-left: 150px">
                      <textarea rows="5" cols="80" style="resize: none;" name="content" value="" class="content" >{$addproduct.content}</textarea>
                    </div>
                    <div style="margin-left: 700px; margin-top: -20px;">
                      <input type="hidden" class="id" name="id" value="{$addproduct.id}">
                      <input type="button" class="button-green" onClick="submitAddProduct(this)" value="保存">
                      <a href="{:U(MODULE_NAME.'/Product/delAddProduct',array('id'=>$addproduct['id']))}" class="button-red" style="padding: 2px 10px;">删除</a>
                    </div>
                </dd>
              </dl>
            </foreach>

          </if>

          <dl>
              <dt>新增附加产品：</dt>
              <dd>
                    <div style="width: 120px; height: 120px;  border: 1px #CCC solid;   position: relative;   overflow: hidden; text-align: center;vertical-align: middle;cursor: pointer;">
                      <div  class="fileupload" onclick="uploadImgHtml(this,'addProductImg','img')"  style="  position: absolute;width: 120px;height: auto;right: 0;left: 0;bottom: 0;top: 0;margin: auto;"></div>
                    </div>
                    <div style="margin-left: 150px; margin-bottom: 10px; margin-top: -120px;">
                      <input type="text" name="name" class="name" style="width: 250px;" placeholder="30个字内"  maxlength="30">
                      <span>价格：</span> <input type="text" name="price" class="price"  width="40" ><span>元</span>
                    </div>
                    <div style="margin-left: 150px; margin-bottom: 10px; font-size: 12px;">
                      <input type="checkbox"><span>默认购买</span>&nbsp;&nbsp;
                      <span>默认购买数量</span>
                      <input type="radio" name="sumType_0" class="sumType_0" value="O"><span>一个</span>
                      <input type="radio" name="sumType_0" class="sumType_0" value="V"><span>游客总数</span>
                      <input type="radio" name="sumType_0" class="sumType_0" value="T"><span>成人总数</span>
                      <input type="radio" name="sumType_0" class="sumType_0" value="C">
                      <span>自定义</span><input type="text" name="custom" class="custom" style=" width: 50px;" disabled>
                    </div>
                    <div style="margin-left: 150px">
                      <textarea rows="5" cols="80" style="resize: none;" name="content" class="content" ></textarea>
                    </div>
                    <div style="margin-left: 700px; margin-top: -20px;">
                      <input type="button" onClick="submitAddProduct(this)" class="button-green" value="保存">
                      <a href="javascript:;" onClick="valEmpty(this)" class="button-red" style="padding:2px 10px;">清空</a>
                    </div>

              </dd>
              </dl>

          <elseif condition="$step eq 9" />

            <dl>
              <dt>棉签妹推荐</dt>
              <dd>
                <input type="text" name="recommend" class="inp_w250" placeholder="10个字内"  maxlength="10" value="{$personRecommend.recommend}">
              </dd>
            </dl>
            <dl>
              <dt>棉签妹头像</dt>
              <dd>
                <div style="width: 120px; height: 120px;  border: 1px #CCC solid;   position: relative;   overflow: hidden; text-align: center;vertical-align: middle;cursor: pointer;">
                  <div  class="fileupload" onclick="uploadImgHtml(this,'HeaderImg','img')" style="  position: absolute;width: 120px;height: auto;right: 0;left: 0;bottom: 0;top: 0;margin: auto;">
                    <if condition="$personRecommend['headerImg'] neq '' ">
                        <img src="{$personRecommend.headerImg}" width="120" height="120" />
                        <input type="hidden" name="img" class="headerImg" value="{$personRecommend.headerImg}">
                    </if>
                  </div>
                </div>
              </dd>
            </dl>
            <dl>
              <dt>棉签妹推荐原因</dt>
              <dd>
                <textarea rows="5" cols="33" style="resize: none;" name="reson" class="font_nums">{$personRecommend.reson}</textarea>
              </dd>
            </dl>
            <dl>
              <dt>棉签妹推荐航班原因</dt>
              <dd>
                <input type="text" name="recommendAirplaneReson" class="inp_w250"  value="{$personRecommend.recommendAirplaneReson}">
              </dd>
            </dl>
            <dl>
              <dt>棉签妹推荐酒店原因</dt>
              <dd>
                <input type="text" name="recommendHotleReson" class="inp_w250" value="{$personRecommend.recommendHotleReson}">
              </dd>
            </dl>

          <elseif condition="$step eq 10" />

          <if condition="$contain" >
            <foreach name="contain" key="key" item="contain">
              <dl>
              <dt> <if condition="$key eq '0'" >当前包装单品：</if></dt>
                <dd>
                    <div style="width: 120px; height: 120px;  border: 1px #CCC solid;   position: relative;   overflow: hidden; text-align: center;vertical-align: middle;cursor: pointer;">
                      <div  class="fileupload" onclick="uploadImgHtml(this,'ContainImg','img')" style="position: absolute;width: 120px;height: auto;right: 0;left: 0;bottom: 0;top: 0;margin: auto;">
                        <img src="{$contain.img}"  width="100%" height="100%">
                        <input type="hidden" name="img" class="headerImg" value="{$contain.img}">
                      </div>
                    </div>
                    <div style="margin-left: 150px; margin-bottom: 10px; margin-top: -120px;">
                      <input type="text" name="name" class="name" value="{$contain.name}" style="width: 504px;" placeholder="30个字内"  maxlength="30">
                    </div>
                    <div style="margin-left: 150px">
                      <textarea rows="5" cols="80" style="resize: none;" name="content" value="" class="content" >{$contain.content}</textarea>
                    </div>
                    <div style="margin-left: 700px; margin-top: -20px;">
                      <input type="hidden" class="id" name="id" value="{$contain.id}">
                      <input type="button" onClick="submitContain(this)" class="button-green" value="保存">
                      <a href="{:U(MODULE_NAME.'/Product/delContain',array('id'=>$contain['id']))}" class="button-red" style="padding: 2px 10px;">删除</a>
                    </div>
                </dd>
              </dl>

            </foreach>
          </if>
          <dl>
              <dt>新增单品：</dt>
              <dd>
                    <div style="width: 120px; height: 120px;  border: 1px #CCC solid;   position: relative;   overflow: hidden; text-align: center;vertical-align: middle;cursor: pointer;">
                      <div  class="fileupload" onclick="uploadImgHtml(this,'ContainImg','img')" style="  position: absolute;width: 120px;height: auto;right: 0;left: 0;bottom: 0;top: 0;margin: auto;"></div>
                    </div>
                    <div style="margin-left: 150px; margin-bottom: 10px; margin-top: -120px;">
                      <input type="text" name="name" class="name" style="width: 504px;" placeholder="30个字内"  maxlength="30">
                    </div>
                    <div style="margin-left: 150px">
                      <textarea rows="5" cols="80" style="resize: none;" name="content" class="content" ></textarea>
                    </div>
                    <div style="margin-left: 700px; margin-top: -20px;">
                      <input type="button" onClick="submitContain(this)" class="button-green" value="保存">
                      <a href="javascript:;" onClick="valEmpty(this)" class="button-red" style="padding:2px 10px;">清空</a>
                    </div>

              </dd>
              </dl>

        <elseif condition="$step eq 11" />

          <if condition="$gifts" >
            <foreach name="gifts" key="key" item="gifts">
              <dl>
              <dt> <if condition="$key eq '0'" >当前赠送单品：</if></dt>
                <dd>

                    <div style="width: 120px; height: 120px;  border: 1px #CCC solid;   position: relative;   overflow: hidden; text-align: center;vertical-align: middle;cursor: pointer;">
                      <div  class="fileupload" onclick="uploadImgHtml(this,'GiftsImg','img')" style="  position: absolute;width: 120px;height: auto;right: 0;left: 0;bottom: 0;top: 0;margin: auto;">
                        <img src="{$gifts.img}"  width="120" height="120">
                        <input type="hidden" name="img" class="headerImg"  value="{$gifts.img}">
                      </div>
                    </div>
                    <div style="margin-left: 150px; margin-bottom: 10px; margin-top: -120px;">
                      <input type="text" name="name" class="name" value="{$gifts.name}" style="width: 250px;" placeholder="30个字内"  maxlength="30">
                      <span>参考价格：</span> <input type="text" name="price" class="price" style=" width: 60px;"  value="{$gifts.price}"><span>元</span>
                    </div>
                    <div style="margin-left: 150px">
                      <textarea rows="5" cols="80" style="resize: none;" name="content" class="content" >{$gifts.content}</textarea>
                    </div>
                    <div style="margin-left: 700px; margin-top: -20px;">
                      <input type="hidden" class="id" name="id" value="{$gifts.id}">
                      <input type="button" onClick="submitGifts(this)" class="button-green" value="保存">
                      <a href="{:U(MODULE_NAME.'/Product/delGifts',array('id'=>$gifts['id']))}" class="button-red" style="padding: 2px 10px;">删除</a>
                    </div>
                </dd>
              </dl>

            </foreach>
          </if>
          <dl>
          <dt>新增赠送单品：</dt>
            <dd>
                <div style="width: 120px; height: 120px;  border: 1px #CCC solid;   position: relative;   overflow: hidden; text-align: center;vertical-align: middle;cursor: pointer;">
                  <div  class="fileupload" onclick="uploadImgHtml(this,'GiftsImg','img')" style="  position: absolute;width: 120px;height: auto;right: 0;left: 0;bottom: 0;top: 0;margin: auto;">

                  </div>
                </div>
                <div style="margin-left: 150px; margin-bottom: 10px; margin-top: -122px">
                  <input type="text" name="name" class="name" style="width: 250px;" placeholder="30个字内" maxlength="30">
                  <span>参考价格：</span> <input type="text" name="price" class="price" style="  width: 60px;" ><span>元</span>
                </div>
                <div style="margin-left: 150px">
                  <textarea rows="5" cols="80" style="resize: none;" name="content"  class="content" ></textarea>
                </div>
                <div style="margin-left: 700px; margin-top: -20px;">
                  <input type="button" onClick="submitGifts(this)" class="button-green" value="保存">
                  <a href="javascript:;" onClick="valEmpty(this)" class="button-red" style="padding:2px 10px;">清空</a>
                </div>

              </dd>
          </dl>

      </if>
      <if condition="($step neq '11') AND ($step neq '10') AND ($step neq '8')" >
      <div class="form_b" style="width: 300px; margin-left: 110px;">
        <input type="button" class="button-green" onClick="submitDo()" value="保 存">
        &nbsp;<input type="button" onclick="goUrl('{:U('/Home/Product/sell')}')" class="button-return" value="返回产品列表">
      </div>
     </if>
    </form>
  </div>
 <script type="text/javascript">

 var price = parseInt(0);

/**
 * [changePriceType description]
 * @param  {[type]} obj [description]
 * @return {[type]}     [description]
 */
function changePriceType()
{

  var keyCode = event.which;
  if ((keyCode >= 37 && keyCode <=40) || keyCode == 110 || keyCode == 190)
  {
    return;
  }
  else
  {
    var libraryID    = $('input[name="libraryID"]').val();
    var addPriceType = $('select[name="addPriceType"]').val();
    var addPriceNums = $('input[name="addPriceNums"]').val();

    var sellPrice    = '';
    switch (addPriceType)
    {
      case '0':
        sellPrice = Math.ceil(price);
        $('input[name="addPriceNums"]').val('');
        $('input[name="addPriceNums"]').attr('disabled','disabled');
        break;

      case '1':

        if(isNaN(parseInt(addPriceNums)))
        {
          sellPrice = Math.ceil(price);
          $('input[name="addPriceNums"]').val(addPriceNums);
        }
        else
        {

          sellPrice = Math.ceil(parseInt(price) + parseInt(addPriceNums));
          $('input[name="addPriceNums"]').val(parseInt(addPriceNums));
        }

        $('input[name="addPriceNums"]').removeAttr('disabled');
        break;

      case '2':
          if(isNaN(parseInt(addPriceNums)))
          {
            sellPrice = Math.ceil(price);
            $('input[name="addPriceNums"]').val(addPriceNums);
          }
          else
          {

            sellPrice =  Math.ceil(parseInt(price) + (parseInt(price) * parseInt(addPriceNums)*0.01));
            $('input[name="addPriceNums"]').val(parseInt(addPriceNums));
          }

        $('input[name="addPriceNums"]').removeAttr('disabled');
        break;
    }
    $('#priceShow').html(sellPrice);
  }

}

/**
 * [getLibrary description]
 * @param  {[type]} obj [description]
 * @return {[type]}     [description]
 */

function  getLibrary(obj)
{
  var libraryID = $(obj).val();

   $.ajax({
     url: "/Home/Product/getLibraryAjax",
     type: 'post',
     dataType: 'json',
     data: {'libraryID': libraryID},
     success:function (data) {
       if(data.valid == true)
       {
          $('#departureCitySow').html(data.departureName);
          $('input[name="libraryTitle"]').val(data.libraryTitle);
          $('input[name="libraryID"]').val(data.libraryID);
          price = data.price;
          $('#priceShow').html(price);
       }
       else
       {
          $('#departureCitySow').empty();
          $('input[name="libraryTitle"]').val('');
          price = parseInt(0);
       }
     }
   })
}
 /**
 * [departureCityAdd description]
 * @param  {[type]} obj [description]
 * @return {[type]}     [description]
 */
  function departureCityAdd (obj)
  {
    var i = '0';
    $(obj).parent().parent().parent().find('select[name="departureCityID[]"]').each(function(index, el) {
      if(el.value == '0'){i++;}
    });

    if(i == '0')
    {
      if($('.selectDepartureNums').length < 3)
      {
        var html = '';
            html += '<div class="selectDepartureNums" style="margin-top: 10px;">';
              html += '<div class="selectDeparture" style="float: left;" >';
                html += '{$departureHtml["0"]}';
              html += '</div>';
              html += '<div class="operateDeparture" style="float: left;" >';
                html += '<a href="javascript:;" onclick="departureCityDel(this)">删除</a>';
              html += '</div>';
              html += '<div class="clear"></div>';
            html += '</div>';
        $(obj).parent().parent().parent().append(html);
      }
      else
      {
         layer.msg('暂只支持最多三个出发地');
      }
    }
    else
    {
      layer.msg('请填写完整已有的出发地选项');
    }
  }
  /**
   * [departureCityDel description]
   * @param  {[type]} obj [description]
   * @return {[type]}     [description]
   */
  function departureCityDel (obj)
  {
    $(obj).parent().parent().remove();
  }

  /**
   * [destinationSelect description]
   * @return {[type]} [description]
   */
  function destinationSelect(obj)
  {
    var destinationID = $(obj).val();
    if(destinationID == '0')
    {
      $(obj).nextAll('select').find('option').not('option[value="0"]').remove();
      return;
    }
    $.ajax({
      url: '{:U(MODULE_NAME.'/Product/destinationDataAjax')}',
      type: 'POST',
      dataType: 'json',
      data: {'destinationID': destinationID},
      success:function  (data) {

        $(obj).nextAll('select').find('option').not('option[value="0"]').remove();
        $(obj).next('select').append(data.destinationChildHtml);

      }
    })
  }
  /**
   * [destination_add description]
   * @return {[type]} [description]
   */
  function destinationHtmlAdd(obj)
  {

    var i = '0';
    $(obj).parent().parent().parent().find('select').each(function(index, el) {
      if(el.value == '0'){i++;}
    });

    if(i == '0')
    {
      if($('.selectDestinationNums').length < 3)
      {
        var html = '';
        html += '<div class="selectDestinationNums" style="margin-top: 10px;">';
            html += '<div class="selectDestination" style="float: left;">';
              html += '{$destinationHtml.areaSelect}';
              html += '&nbsp;';
              html += '{$destinationHtml.countrySelect}';
              html += '&nbsp;';
              html += '{$destinationHtml.citySelect}';
            html += '</div>';
            html += '<div class="operateDestination" style="float: left;">';
              html += '<a href="javascript:;" onclick="destinationHtmlDel(this)">删除</a>';
            html += '</div>';
            html += '<div class="clear"></div>';
        html += '</div>';
        $(obj).parent().parent().parent().append(html);
      }
      else
      {
         layer.msg('暂只支持最多三个目的地');
      }
    }
    else
    {
      layer.msg('请填写完整已有的目的地选项');
    }
  }
  /**
   * [destinationHtmlDel description]
   * @return {[type]} [description]
   */
  function destinationHtmlDel(obj)
  {
    $(obj).parent().parent().remove();
  }
 /**
  * [submitDo description]
  * @return {[type]} [description]
  */
function submitDo()
{
  if($('input[name="title"]').length > 0)
  {
    if($('input[name="title"]').val().length > 0)
    {
      $('input[name="title"]').css('border','1px green solid');
      $('#form_do').submit();
    }
    else
    {
      $('input[name="title"]').css('border','1px red solid');
    }
  }
  else
  {
    $('#form_do').submit();
  }

}
/**
 * [submitAddProduct description]
 * @param  {[type]} obj [description]
 * @return {[type]}     [description]
 */
 function submitAddProduct(obj)
 {
  var AddProduct = $(obj).parent().parent();
  var id         = AddProduct.find('.id').val();
  var productID  = "{$id}";
  var img        = AddProduct.find('.headerImg').val();
  var price      = AddProduct.find('.price').val();

  if(AddProduct.find('input[type="radio"]:last').is(':checked') == true)
  {
    var sumType = AddProduct.find('.custom').val();
  }
  else
  {
    var sumType = AddProduct.find('input[type="radio"]:checked').val();
  }

  var name       = AddProduct.find('.name').val();
  var content    = AddProduct.find('.content').val();

  $.ajax({
    url: '{:U(MODULE_NAME.'/Product/submitAddProduct')}',
    type: 'post',
    dataType: 'json',
    data: {'productID': productID,'id': id,'img': img,'price': price,'sumType': sumType,'name': name,'content': content},
    success:function  (data)
    {
        if(data.status == 1)
        {
          location.reload();
        }
    }
  })
 }

/**
 * [categoryLabelList description]主站分类标签分类
 * @return {[type]} [description]
 */
 function categoryLabelList (obj)
 {

   $.ajax({
     url: '{:U(MODULE_NAME.'/Product/categoryLabelList')}',
     type: 'get',
     dataType: 'json',
     data: {'id': $(obj).val()},
     success:function  (data)
     {
       $('#categoryLabelList').html(data.html);
     }
   })
 }
 /**
  * [valEmpty description]清空
  * @param  {[type]} obj [description]
  * @return {[type]}     [description]
  */
 function valEmpty (obj)
 {
   var object   = $(obj).parent().parent();
    object.find('.fileupload').empty();
    // object.find('.name').val('');
    // object.find('.price').val('');
    // object.find('.content').val('');
    object.find('input[type="text"]').val('');
    object.find('input[type="radio"],input[type="checkbox"]').removeAttr('checked');
 }
/**
 * [packCategory description]主站分类
 * @param  {[type]} obj [description]
 * @return {[type]}     [description]
 */
 function packCategory (obj)
 {
   var packCategoryOne = $(obj).val();
   $(obj).nextAll().remove();
   if(packCategoryOne == 0)return;
   $.ajax({
     url: '{:U(MODULE_NAME.'/Product/packCategoryAjax')}',
     type: 'get',
     dataType: 'json',
     data: {'packCategoryOne': packCategoryOne},
     success:function (data)
     {
       $(obj).parent().append(data.html);
     }
   })

 }
/**
 * [currentContainAdd description]当前包含单品添加html
 * @param  {[type]} argument [description]
 * @return {[type]}          [description]
 */
function submitContain(obj)
{

  var Contain   = $(obj).parent().parent();
  var id        = Contain.find('.id').val();
  var productID = "{$id}";
  var img       = Contain.find('.headerImg').val();
  var name      = Contain.find('.name').val();
  var content   = Contain.find('.content').val();
  $.ajax({
    url: '{:U(MODULE_NAME.'/Product/submitContain')}',
    type: 'post',
    dataType: 'json',
    data: {'productID': productID,'id': id,'img': img,'name': name,'content': content},
    success:function  (data)
    {
        if(data.status == 1)
        {
          location.reload();
        }
    }
  })

}
/**
 * [submitGifts description]
 * @param  {[type]} obj [description]
 * @return {[type]}     [description]
 */
function submitGifts(obj)
{

  var Gifts     = $(obj).parent().parent();
  var id        = Gifts.find('.id').val();
  var productID = "{$id}";
  var img       = Gifts.find('.headerImg').val();
  var name      = Gifts.find('.name').val();
  var price     = Gifts.find('.price').val();
  var content   = Gifts.find('.content').val();
  $.ajax({
    url: '{:U(MODULE_NAME.'/Product/submitGifts')}',
    type: 'post',
    dataType: 'json',
    data: {'productID': productID,'id': id,'img': img,'name': name,'price' : price,'content': content},
    success:function  (data)
    {
        if(data.status == 1)
        {
          location.reload();
        }
    }
  })

}
 /**
 * [visaValue description]
 * @param  {[type]} obj [description]
 * @return {[type]}     [description]
 */
function visaValue(obj)
{
  var checked = $(obj).attr('checked');
  if(checked == 'checked')
    {
      $(obj).val('1');
    }
    else
    {
      $(obj).val('');
    }
}

//autocomplete
function formatItem(row){return row;}
function findValue(li) {
  if( li == null ) return false;
  var sValue = li.selectValue;
  if( !!li.extra )
  {
    sValue = li.extra[0];
  }
}
function selectItem(li) {findValue(li);}

$(function() {

  $('input[type="radio"]').click(function ()
  {
    if($(this).parent().find('input[type="radio"]:last').is(':checked') == true)
    {
      $(this).parent().find('.custom').removeAttr('disabled');
    }
    else
    {
      $(this).parent().find('.custom').val('');
      $(this).parent().find('.custom').attr('disabled','disabled');
    }
  });



    $('#check').change(function(){
        var a = $('#check').attr('checked');
        if(a == 'checked'){
          $('#chinaprovince').val('');
          $('#chinaprovince').attr('disabled',true);
          $('#local').removeAttr('style');
        }else{
          $('#chinaprovince').removeAttr('disabled');
          $('#local').css('display','none');
          $("[name='localid[]']").removeAttr("checked");
        }
    });


});


/**
 * [addproduct_add description]
 * @return {[type]} [description]
 */
function addproduct_add()
{
  var content = '<div>';
  content += '<input type="text" size="100" name="title[]" class="inp_w250" placeholder="名称" value="">';
  content += ' - <input type="text" size="100" name="price[]" class="inp_small" placeholder="价格" value="">';
  content += '<span onclick="addproduct_del(this)" class="span_del"><a href="javascript:" class="button-red" style="padding: 2px 10px;">删除</a></span></div>';
  $('#addproduct_add').append(content);
}

function addproduct_del(o)
{
  $(o).parent().remove();
}


function  productTypeEdit(typeName)
{
  var html = '';
      html +='<div class="form">';
        html +='<form method="post" action="">';
          html +='<dl>';
            html +='<dt>请输入'+typeName+'的产品ID：</dt>';
            html +='<dd>';
              html +='<input name="title" class="inp_one" value=""  type="text"/>';
            html +='</dd>';
          html +='</dl>';
          html +='<dl>';
            html +='<dt> 请设置加价幅度：</dt>';
            html +='<dd>';
              html +='<input name="price" class="inp_one" value=""  type="text"/>';
            html +='</dd>';
          html +='</dl>';
        html +='</form>';
      html +='</div>';
  //页面层-自定义
  layer.open({
      type: 1,
      title: false,
      // shade: 0.8,
      btn:['确认','取消'],
      skin: 'layui-layer-rim',
      area: ['20%', '23%'],
      shift: 0, //从左动画弹出
      content: html,
      yes: function(index, layero){
          layer.msg('ok');
          layer.close(index); //如果设定了yes回调，需进行手工关闭
      },
      cancel: function(index){
        layer.msg('error');
      }
  });
}


/**
 * [uploadImgHtml description]
 * @return {[type]} [description]
 */
function uploadImgHtml(obj,type,thumbImages)
{
  var sizeType = 0;
  if(thumbImages == 'bigPic')sizeType = 1;
  var cityID   = 0;
  if($('select[name="cityID[]"]:first').length > 0 )
  {
    cityID = $('select[name="cityID[]"]:first').val();
  }

  //iframe层-父子操作
  var Div = layer.open({
              type: 2,
              area: ['800px', '400px'],
              content: ['/Home/Public/uploadImages.html?&type='+type+'&sizeType='+sizeType+'&cityID='+cityID,'no'],
              btn: ['确认','取消'], //按钮
              yes: function(index, layero){ //或者使用btn1
                  //按钮【按钮一】的回调

                  var objlayer = $(window.frames['layui-layer-iframe'+index].document);
                  var objlayercurrimg = objlayer.find("#selectImg ul li .curr");
                  if(objlayercurrimg.length <= 0)
                  {
                    var imgUrl = objlayer.find("#dndArea input[name='fileData[]']").val();
                  }
                  else
                  {
                    var imgUrl = objlayercurrimg.parent().find('img').attr('src')
                  }

                  $(obj).empty();
                  $(obj).append('<img src="'+imgUrl+'" width="100%" height="100%"><input type="hidden" name="'+thumbImages+'" class="headerImg" value="'+imgUrl+'">');
                  layer.close(Div);
              },
              cancel: function(index){ //或者使用btn2
                  //按钮【按钮二】的回调
                  layer.close(Div);
              }
          });
}
</script>